﻿using GeneticAlgorithms.Genomes;

namespace GeneticAlgorithms.Operators.Crossover
{
    /// <summary>
    /// Base interface for crossover operators.
    /// </summary>
    /// <typeparam name="TGenome">The type of the genome.</typeparam>
    /// <typeparam name="TGene">The type of the gene.</typeparam>
    public interface IGeneticCrossover<TGenome, TGene>
        where TGenome : IGenome<TGene>
    {
        /// <summary>
        /// Gets the cardinality of the crossover.
        /// </summary>
        /// <value>
        /// The cardinality of the crossover
        /// operation, that is the number of expected
        /// parents to be provided, as well as the number
        /// of resulting children.
        /// </value>
        int Cardinality { get; }

        /// <summary>
        /// Crosses the specified parents, populating the
        /// children array with the resulting genomes.
        /// </summary>
        /// <param name="parents">The parents who will cross.</param>
        /// <param name="children">The resulting children.</param>
        void Cross(TGenome[] parents, TGenome[] children);
    }
}
